package com.test.asyncImageLoader;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.ImageView;

public class MainActivity extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		//loadImage("http://cfile25.uf.tistory.com/image/1479BC404DAD419A334EFD",R.id.imageView1);
		loadImage("http://cfile29.uf.tistory.com/image/157BB8404DAD41A2153FFE",R.id.imageView2);
		loadImage("http://cfile4.uf.tistory.com/image/20012C404DAD41A50A3AFE",R.id.imageView3);
		loadImage("http://cfile10.uf.tistory.com/image/1505FF404DAD41A9015F83",R.id.imageView4);
		loadImage("http://cfile29.uf.tistory.com/image/1470EA404DAD41AA240959",R.id.imageView5);
		loadImage("http://cfile3.uf.tistory.com/image/137F1C404DAD41B1067D06",R.id.imageView6);
		loadImage("http://t4.qpic.cn/mblogpic/9beb88752e7b1e25a0a4/2000.jpg",R.id.imageView7);
		loadImage("http://t1.qpic.cn/mblogpic/43f217a954294fcaec9c/2000.jpg",R.id.imageView8);
	}

	private void loadImage(String url, int id) {
		ImageView imageView = (ImageView) findViewById(id);
		Drawable cacheImage = new AsyncImageLoader().loadDrawable(url,
				new CallBackImpl(imageView));
		if (cacheImage != null) {
			imageView.setImageDrawable(cacheImage);
		}
	}
}